import datetime
from gaesessions import SessionMiddleware
from app_global import EXPIRE_INTERVAL_SESSION
from google.appengine.ext.appstats import recording

def webapp_add_wsgi_middleware(app):
	app = SessionMiddleware(app, 
		cookie_key="23a2ffaf4ffd2ab136a61f1f1b5a343ef142fb8c3af56f46f8600d901bd5d4aac0e5cdff607274b423be90e6c650fb85b3a1994d2f5864a493b42f1daed3e93b",
		lifetime=datetime.timedelta(seconds=EXPIRE_INTERVAL_SESSION))
	app = recording.appstats_wsgi_middleware(app)
	return app
